//package net.xdclass.controller;
//
//import net.xdclass.config.MinioConfig;
//import net.xdclass.util.CommonUtil;
//import net.xdclass.util.JsonData;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.multipart.MultipartFile;
//import java.io.InputStream;
//
///**
// * @author 姜阿木
// * @date 2025/5/2 16:52)
// */
//
//@RestController
//@RequestMapping("/api/test/v1")
//public class TestController {
//
//    @Autowired
//    private MinioConfig minioConfig;
//
//
////    @Autowired
////    private MinioClient minioclient;
//
//    @PostMapping("/upload")
//    public JsonData testUpload(@RequestParam("file") MultipartFile file){
//
//        String filename = CommonUtil.getFilePath(file.getOriginalFilename());
//
//        // 读取文件流 上传到minio
//        try {
//            InputStream inputStream = file.getInputStream();
//
////            minioclient.putObject(PutObjectArgs.builder().bucket(minioConfig.getBucketName())
////                .object(filename)
////                .stream(inputStream, file.getSize(), -1)
////                .contentType(file.getContentType())
////                .build());
//        }
//        catch (Exception e) {
//            e.printStackTrace();
//        }
//
//        String URL = minioConfig.getEndpoint() + "/" + minioConfig.getBucketName() + "/" + filename;
////        String URL = minioConfig.getEndpoint() + "/" + minioConfig.getBucketName() + "/" + CommonUtil.getFilePath(file.getName());
//        return JsonData.buildSuccess(URL);
//
//    }
//
//
//}
